<?php
// 模拟登录状态，可以根据实际需求修改
$isLoggedIn = false;  // 如果用户已登录，可以设置为 true
$userName = "张三";    // 假设用户名称为 "张三"
?>

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>网页头部示例</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
        }
        header {
            background-color: #333;
            color: white;
            padding: 15px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .logo {
            font-size: 24px;
        }
        .user-info {
            display: flex;
            gap: 15px;
        }
        .user-info a {
            color: white;
            text-decoration: none;
        }
        .user-info a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>

<header>
    <div class="logo">网站Logo</div>
    <div class="user-info">
        <?php if ($isLoggedIn): ?>
            <!-- 用户已登录时显示 -->
            <a href="#"><?php echo $userName; ?></a>
            <a href="#">会员登记</a>
        <?php else: ?>
            <!-- 用户未登录时显示 -->
            <a href="#">登录</a>
            <a href="#">注册</a>
        <?php endif; ?>
    </div>
</header>

</body>
</html>
